import fetch from '@/utils/fetch'
import { removeDateTime } from "@/filters";

export function created(data) {
    return fetch({
        url: '/api/upms/department/add',
        method: 'post',
        data
    })
}

export function updated(data) {
    data = removeDateTime(data)
    return fetch({
        url: '/api/upms/department/update',
        method: 'post',
        data
    })
}

export function deleted(id) {
    return fetch({
        url: '/api/upms/department/delete/'+id,
        method: 'get'
    })
}

export function fetchObject(id) {
    return fetch({
        url: '/api/upms/department/get/'+id,
        method: 'get'
    })
}

export function fetchTree(query) {
    return fetch({
        url: '/api/upms/department/tree',
        method: 'get',
        params: query
    })
}

export function removeDepartmentAssignAllUser(query) {
    return fetch({
        url: '/api/upms/department/remove_department_all_user',
        method: 'get',
        params: query
    })
}

export function removeDepartmentAssignUser(query) {
    return fetch({
        url: '/api/upms/department/remove_department_user',
        method: 'get',
        params: query
    })
}
